using System;
using System.Windows;
using System.Xml.Serialization;

namespace MaxAlarm.Core.Settings
{
    [XmlType("alert")]
    public class AlertSettings : DependencyObject, ICloneable
    {
        public static readonly DependencyProperty PlaySoundProperty =
            DependencyProperty.Register("PlaySound", typeof (bool), typeof (AlertSettings), new PropertyMetadata(false));

        [XmlAttribute("play-sound")]
        public bool PlaySound
        {
            get { return (bool) GetValue(PlaySoundProperty); }
            set { SetValue(PlaySoundProperty, value); }
        }

        public static readonly DependencyProperty IsCyclicProperty =
            DependencyProperty.Register("IsCyclic", typeof (bool), typeof (AlertSettings), new PropertyMetadata(false));

        [XmlAttribute("is-cyclic")]
        public bool IsCyclic
        {
            get { return (bool) GetValue(IsCyclicProperty); }
            set { SetValue(IsCyclicProperty, value); }
        }

        public static readonly DependencyProperty PathToFileProperty =
            DependencyProperty.Register("PathToFile", typeof (string), typeof (AlertSettings), new PropertyMetadata(string.Empty));

        [XmlAttribute("sound-file")]
        public string PathToFile
        {
            get { return (string) GetValue(PathToFileProperty); }
            set { SetValue(PathToFileProperty, value); }
        }

        public object Clone()
        {
            return new AlertSettings
                       {
                           PlaySound = PlaySound,
                           IsCyclic = IsCyclic,
                           PathToFile = PathToFile
                       };
        }
    }
}